﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="Product.aspx.cs" Inherits="VINETLIFE.AdminCP.Product" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        p {
            margin-bottom: 12px;
        }
    </style>
    <!--Color picker-->
    <link rel="stylesheet" media="screen" type="text/css" href="/Admincp/css/colorpicker.css" />
    <script type="text/javascript" src="/Admincp/js/colorpicker.js"></script>
    <script>

        function pageLoad() {
            $(document).ready(function () {
                $('.txtColor, .txtColors').ColorPicker({
                    onSubmit: function (hsb, hex, rgb, el) {
                        $(el).val(hex);
                        $(el).ColorPickerHide();
                    },
                    onBeforeShow: function () {
                        $(this).ColorPickerSetColor(this.value);
                    }
                })
                                        .bind('keyup', function () {
                                            $(this).ColorPickerSetColor(this.value);
                                        });
            });
        }
    </script>
    <!--End Color picker-->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
        <asp:Literal runat="server" ID="ltrAction"></asp:Literal></h2>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <ajax:TabContainer runat="server" ID="x">
                <ajax:TabPanel HeaderText="Thông tin" runat="server">
                    <ContentTemplate>
                        <table class="tablet">
                            <tr>
                            </tr>
                            <tr>
                                <td>Mã sản phẩm
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtProductCode" Width="100px"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="*"
                                        ForeColor="Red" ControlToValidate="txtProductCode" ValidationGroup="sbmitGrp"></asp:RequiredFieldValidator>
                                </td>
                                <td>Tên sản phẩm
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtProductTitle" Width="250px"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                                        ForeColor="Red" ControlToValidate="txtProductTitle" ValidationGroup="sbmitGrp"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>Nguồn gốc
                                </td>
                                <td>
                                    <asp:DropDownList runat="server" ID="ddlOrigin" AppendDataBoundItems="true" AutoPostBack="true"
                                        OnSelectedIndexChanged="ddlParentCate_SelectedIndexChanged">
                                        <asp:ListItem Text=".: Chọn  :." Value="0"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td>Ảnh khuyến mãi
                                </td>
                                <td>
                                    <asp:FileUpload ID="fulImages" runat="server" AutoPostBack="false" />
                                    <asp:HyperLink runat="server" Target="_blank" ID="hplImages" Text="[Xem ảnh]" Visible="false"
                                        TabIndex="11"></asp:HyperLink>
                                    <br />
                                    <%--<hr />--%>
                                    <asp:FileUpload ID="fullKM1" runat="server" Visible="false" />
                                    <asp:HyperLink runat="server" Target="_blank" ID="hplChartImages" Text="[Xem ảnh]"
                                        Visible="false" TabIndex="11"></asp:HyperLink>
                                </td>
                            </tr>
                            <tr>
                                <td>Kho hàng
                                </td>
                                <td>
                                    <telerik:RadComboBox runat="server" ID="ddlProductLocation" OnItemDataBound="ddlProductLocation_ItemDataBound" Width="250px" EmptyMessage=" .: Chọn kho hàng :. " Filter="StartsWith" CheckBoxes="true" DataValueField="LocationCode" DataTextField="Location" EnableCheckAllItemsCheckBox="true">
                                    </telerik:RadComboBox>
                                </td>
                                <td>Ảnh đại diện
                                    <br />
                                    <%--  <hr />
                            Ảnh bản vẽ chi tiết--%>
                                </td>
                                <td>
                                    <asp:FileUpload ID="fulImage" runat="server" AutoPostBack="false" />
                                    <asp:HyperLink runat="server" Target="_blank" ID="hplImage" Text="[Xem ảnh]" Visible="false"
                                        TabIndex="11"></asp:HyperLink>
                                    <br />
                                    <%--<hr />--%>
                                    <asp:FileUpload ID="fuAnhBanVe" runat="server" Visible="false" />
                                    <asp:HyperLink runat="server" Target="_blank" ID="hplChartImage" Text="[Xem ảnh]"
                                        Visible="false" TabIndex="11"></asp:HyperLink>
                                </td>

                            </tr>
                            <tr>
                                <td>Tình trạng hàng
                                </td>
                                <td>
                                    <asp:RadioButton ID="rdActive" GroupName="Active" runat="server" />Còn hàng &nbsp;&nbsp;&nbsp;
                                    <asp:RadioButton ID="RadioButton1" GroupName="Active" runat="server" />Hết hàng
                                </td>
                                <td>Số thứ tự
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtOrderID" Width="50px" Text="0"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                                        ForeColor="Red" ControlToValidate="txtOrderID" ValidationGroup="sbmitGrp"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Nhập số" ControlToValidate="txtOrderID"
                                        Type="Integer" MinimumValue="0" MaximumValue="100" ValidationGroup="sbmitGrp"></asp:RangeValidator>
                                </td>
                            </tr>
                            <tr>
                            </tr>
                            <tr>
                                <td>Đơn giá
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtPrice" Width="250px" Text="0"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                                        ForeColor="Red" ControlToValidate="txtPrice" ValidationGroup="sbmitGrp"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="Nhập số" ControlToValidate="txtPrice"
                                        Type="Double" MinimumValue="0" MaximumValue="99999999999" ValidationGroup="sbmitGrp"></asp:RangeValidator>
                                </td>
                                <td>Tùy chọn
                                </td>
                                <td>Sản phẩm mới:
                                    <asp:CheckBox runat="server" ID="cbIsNew" />
                                    Sản phẩm bán chạy:
                                    <asp:CheckBox runat="server" ID="cbIsBestBuy" />
                                </td>
                            </tr>
                            <tr>
                                <td>Bảo hành
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtWarranty" Width="250px"></asp:TextBox>
                                </td>
                                <td>Hiển thị tại trang chủ
                                </td>
                                <td>
                                    <asp:CheckBox runat="server" ID="cboIsHomePage" />
                                    <span class="note-pro">Sản phẩm này thuộc trang chủ(Khuyến mãi/sản phẩm mới)</span>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 200px;">Chọn danh mục sản phẩm
                                </td>
                                <td>
                                    <asp:DropDownList runat="server" ID="ddlParentCate" AppendDataBoundItems="true" AutoPostBack="false"
                                        OnSelectedIndexChanged="ddlParentCate_SelectedIndexChanged" DataTextField="ProductCategoryTitle" DataValueField="ProductCategoryID">
                                        <asp:ListItem Text=".: Danh mục cao nhất :." Value="0"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td></td>
                                <td></td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajax:TabPanel>
                <ajax:TabPanel ID="TabPanel3" HeaderText="Thuộc tính" runat="server" Visible="false">
                    <ContentTemplate>
                        <table class="tablet">
                            
                            <tr style="display:none;">
                                <td>Chọn danh mục thuộc tính
                                </td>
                                <td>
                                    <asp:DropDownList runat="server" ID="dropCate" AppendDataBoundItems="true" AutoPostBack="true"
                                        OnSelectedIndexChanged="dropCate_SelectedIndexChanged">
                                        <asp:ListItem Text=".: Loại thuộc tính :." Value="0"></asp:ListItem>
                                        <asp:ListItem Text=".: Thuộc tính xe đạp :." Value="1" Selected="True"></asp:ListItem>
                                        <asp:ListItem Text=".: Thuộc tính phụ kiện :." Value="2"></asp:ListItem>
                                    </asp:DropDownList>
                                    <p>
                                        <asp:Repeater runat="server" ID="rptListProperties" OnItemDataBound="rptListProperties_ItemDataBound">
                                            <ItemTemplate>
                                                <p>
                                                    <asp:Label runat="server" ID="lblID" Visible="false"></asp:Label>
                                                    <asp:Label runat="server" ID="lblPropertyID" Visible="false" Text='<%#Eval("PropertyID") %>'></asp:Label>
                                                    <asp:Label runat="server" ID="lblPropertyName" Text='<%#Eval("PropertyName") %>'></asp:Label>
                                                    <%--<asp:TextBox runat="server" ID="txtValue" Text='<%#Eval("Value") %>'></asp:TextBox>--%>
                                                    <asp:TextBox runat="server" ID="txtValue" Text=""></asp:TextBox>
                                                    <asp:Label runat="server" ID="lblValue" Style="color: #c1b2b2; font-size: 12px;"
                                                        Visible="false" Text=""></asp:Label>
                                                </p>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </p>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajax:TabPanel>
                <ajax:TabPanel HeaderText="Mô tả" runat="server">
                    <ContentTemplate>
                        <ajax:TabContainer runat="server" ID="SX">
                             <ajax:TabPanel runat="server" HeaderText="Mô tả khi di chuột">
                                <ContentTemplate>
                                     <asp:TextBox runat="server" ID="txtHomeDescription" TextMode="MultiLine" Width="80%" Height="200px" ></asp:TextBox>
                                </ContentTemplate>
                            </ajax:TabPanel>
                            <ajax:TabPanel runat="server" HeaderText="Mô tả ngắn">
                                <ContentTemplate>
                                    <CKEditor:CKEditorControl ID="txtFDescription" runat="server"></CKEditor:CKEditorControl>
                                </ContentTemplate>
                            </ajax:TabPanel>
                            <ajax:TabPanel runat="server" HeaderText="Mô tả chi tiết">
                                <ContentTemplate>
                                     <CKEditor:CKEditorControl ID="txtMoTaChiTiet" runat="server"></CKEditor:CKEditorControl>
                                </ContentTemplate>
                            </ajax:TabPanel>
                              <ajax:TabPanel runat="server" HeaderText="Điều kiện sử dụng">
                                <ContentTemplate>
                                     <CKEditor:CKEditorControl ID="txtTermOfUse" runat="server"></CKEditor:CKEditorControl>
                                </ContentTemplate>
                            </ajax:TabPanel>
                              <ajax:TabPanel runat="server" HeaderText="Nhà cung cấp">
                                <ContentTemplate>
                                     <CKEditor:CKEditorControl ID="txtProvider" runat="server"></CKEditor:CKEditorControl>
                                </ContentTemplate>
                            </ajax:TabPanel>
                        </ajax:TabContainer>
                        <table class="tablet">
                            <tr style="display: none">
                                <td>Hình ảnh
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="TextBox1" Width="400px"></asp:TextBox><br />
                                    <telerik:DialogOpener runat="server" ID="DialogOpener1"></telerik:DialogOpener>
                                    <button onclick="$find('<%= DialogOpener1.ClientID %>').open('ImageManager', {CssClasses: []});return false;">
                                        Open ImageManager</button>
                                    <button onclick="OpenDocManager();return false;">
                                        Open Document Manager</button>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajax:TabPanel>
                <ajax:TabPanel ID="TabPanel1" HeaderText="Chương trình khuyến mãi" runat="server">
                    <ContentTemplate>
                        <table class="tablet">
                            <tr>
                                <td style="width: 250px;">Là sản phẩm khuyến mãi
                                </td>
                                <td>
                                    <asp:CheckBox runat="server" ID="cboIsPromotion" />
                                </td>
                            </tr>
                            <tr>
                                <td>Sản phẩm khuyến mãi nổi bật
                                </td>
                                <td>
                                    <asp:CheckBox runat="server" ID="cboIsSetTop" />
                                    <span class="note-pro">Sản phẩm Thuộc Hotdeal</span>
                                </td>
                            </tr>
                            <tr>
                                <td>Giá khuyến mãi
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtSalePrice" Width="250px" Text="0"></asp:TextBox>
                                    <asp:RangeValidator ID="RangeValidator3" runat="server" ErrorMessage="Nhập số" ControlToValidate="txtSalePrice"
                                        Type="Double" MinimumValue="0" MaximumValue="99999999999" ValidationGroup="sbmitGrp"></asp:RangeValidator>
                                </td>
                            </tr>
                              <tr>
                                <td>Giá dành cho hội viên
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtMemberPrice" Width="250px" Text="0"></asp:TextBox>
                                    <asp:RangeValidator ID="RangeValidator5" runat="server" ErrorMessage="Nhập số" ControlToValidate="txtMemberPrice"
                                        Type="Double" MinimumValue="0" MaximumValue="99999999999" ValidationGroup="sbmitGrp"></asp:RangeValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>Thời gian kết thúc
                                </td>
                                <td>
                                    <div>
                                        Chọn ngày:
                                        <telerik:RadDatePicker ID="dtNgayXB" Culture="English (United States)" runat="server">
                                            <DateInput DateFormat="dd/MM/yyyy">
                                            </DateInput>
                                        </telerik:RadDatePicker>
                                        Chọn giờ:
                                        <asp:DropDownList CssClass="dropdown" ID="ddlHour" runat="server" Style="font-weight: bold">
                                        </asp:DropDownList>
                                        &nbsp;&nbsp; Chọn phút:
                                        <asp:DropDownList CssClass="dropdown" ID="ddlMin" runat="server" Style="font-weight: bold">
                                        </asp:DropDownList>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>Sản phẩm đã hết khuyến mãi
                                </td>
                                <td>
                                    <asp:CheckBox runat="server" ID="cboIsFinished" />
                                    <span class="note-pro">Sản phẩm khuyến mãi đã hết hạn, không hiển thị nữa</span>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajax:TabPanel>
                <ajax:TabPanel ID="TabPanel2" HeaderText="Thông tin SEO" runat="server">
                    <ContentTemplate>
                        <table class="tablet">
                            <tr>
                                <td style="width: 150px;">MetaDes<br />
                                    Độ dài: 70~160 ký tự
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtMetaDes" Width="99%" Height="50px" TextMode="MultiLine"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>MetaTag
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtMetaTag" Width="99%" Height="50px" TextMode="MultiLine"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>PageTitle
                                    <br />
                                    Độ dài: 10~70 ký tự
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtpagsTitle" Width="99%" Height="50px" TextMode="MultiLine"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </ajax:TabPanel>
                <ajax:TabPanel ID="TabPanelColor" HeaderText="Màu sắc sản phẩm" runat="server">
                    <ContentTemplate>
                        <div style="float: left; width: 99%; margin: 10px 0; border: 1px solid #ccc; padding: 5px;"
                            runat="server" id="divProductColor" visible="false">
                            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <h3 class="h3-color">Quản lý màu sắc sản phẩm</h3>
                                    <asp:GridView Font-Size="12px" ID="gvProductColor" runat="server" AutoGenerateColumns="False"
                                        CssClass="tstyle2" Width="100%" DataKeyNames="ProductColorID" OnPageIndexChanging="gvProductColor_PageIndexChanging"
                                        OnRowDeleting="gvProductColor_RowDeleting" OnSelectedIndexChanged="gvProductColor_SelectedIndexChanged"
                                        OnRowCommand="gvProductColor_RowCommand" AllowPaging="True" PageSize="20">
                                        <Columns>
                                            <asp:BoundField DataField="ProductColorID" HeaderText="ID" ItemStyle-Width="10%"
                                                ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                                            <asp:BoundField DataField="Color" ItemStyle-HorizontalAlign="Left" HeaderText="Mã màu"
                                                ItemStyle-Width="20%">
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                            </asp:BoundField>
                                            <asp:TemplateField HeaderText="Màu sắc" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <span class="colorx" style='background: <%#Eval("Color") %>'></span>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="ProductID" ItemStyle-HorizontalAlign="Left" HeaderText="ProductID"
                                                ItemStyle-Width="20%">
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                            </asp:BoundField>
                                            <asp:TemplateField HeaderText="Hình ảnh" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center">
                                                <ItemTemplate>
                                                    <a class="fancyboxx" href='/Media/<%#Eval("Image")%>'>
                                                        <img alt='' class="color-image" src='/Media/<%#Eval("Image")%>' />
                                                    </a>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="OrderID" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%"
                                                HeaderText="Số thứ tự"></asp:BoundField>
                                            <asp:TemplateField ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" HeaderText="Thao tác">
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="bnEdit" runat="server" CommandName="Select" ImageUrl="~/AdminCP/images/edit_16x16.gif" />
                                                    <asp:ImageButton ID="bnDelete" runat="server" CommandArgument='<%#Eval("ProductColorID") %>'
                                                        CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                                                </ItemTemplate>
                                                <ItemStyle Width="50px"></ItemStyle>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                    <div style="float: left; width: 100%; margin: 10px 0;">
                                        <h3 class="h3-color">Thêm/chỉnh sửa Màu sắc - hình ảnh sản phẩm</h3>
                                        <table width="100%" class="tablet" style="border: 1px solid black;">
                                            <tr>
                                                <td>Mã màu
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtColor" CssClass="txtColor" Width="100px"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ControlToValidate="txtColor" ID="RequiredFieldValidator4"
                                                        runat="server" ErrorMessage="*" ValidationGroup="groupTab"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>Hình ảnh
                                                </td>
                                                <td>
                                                    <asp:FileUpload ID="fuColorImage" runat="server" AutoPostBack="false" />
                                                    <asp:HyperLink runat="server" Target="_blank" ID="hplColor" Text="[Xem ảnh]" Visible="false"
                                                        TabIndex="11"></asp:HyperLink>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>Sắp xếp
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtTabOrderID" Width="50px" Text="0"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ControlToValidate="txtTabOrderID" ID="RequiredFieldValidator5"
                                                        runat="server" ErrorMessage="*" ValidationGroup="groupTab"></asp:RequiredFieldValidator>
                                                    <asp:RangeValidator ID="RangeValidator4" runat="server" ErrorMessage="Chỉ nhập số"
                                                        ControlToValidate="txtTabOrderID" ValidationGroup="groupTab" Type="Integer" MinimumValue="0"
                                                        MaximumValue="100"></asp:RangeValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td></td>
                                                <td>
                                                    <asp:Button runat="server" ID="btnTabSave" Text="Lưu" ValidationGroup="groupTab"
                                                        OnClick="btnTabSave_Click" CssClass="button-gg-green" />
                                                    <asp:Button runat="server" ID="Button1" Text="Hủy" ValidationGroup="groupTab" CssClass="button-gg-green" />
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:PostBackTrigger ControlID="btnTabSave" />
                                </Triggers>
                            </asp:UpdatePanel>
                            <asp:UpdateProgress AssociatedUpdatePanelID="UpdatePanel2" runat="server" ID="process">
                                <ProgressTemplate>
                                    <img alt="" src="/images/update.gif" />
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </div>
                    </ContentTemplate>
                </ajax:TabPanel>
            </ajax:TabContainer>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div style="float: left; width: 100%; margin: 10px 0;">
        <asp:Button runat="server" ID="btnLuu" Text="Lưu thay đổi" CssClass="button-gg-green"
            OnClick="btnLuu_Click" ValidationGroup="sbmitGrp" />
        <asp:Button runat="server" ID="btnBack" Text="Quay về trang danh sách sản phẩm" CssClass="button-gg-green"
            OnClick="btnBack_Click" />
    </div>
</asp:Content>
